#pragma once
#include "BindingHeader.hpp"


void Bind_ResourceClasses(lua_State* l)
{
	using namespace luabind;
	using namespace CEGUI;

	module(l,"Cegui")
		[
			class_<Texture>("Texture")			
			.property("Size",&Texture::getSize)
			.property("OriginalDataSize",&Texture::getOriginalDataSize)
			.property("TextureScaling",&Texture::getTexelScaling)
			.enum_("PixelFormat")
			[
				value("PF_RGB",Texture::PF_RGB),
				value("PF_RGBA",Texture::PF_RGBA)
			]
			,
			class_<Imageset>("Imageset")
			.property("Texture",&Imageset::getTexture)
			.property("Name",&Imageset::getName)
			.property("ImageCount",&Imageset::getImageCount)
			.property("AutoScaled",&Imageset::isAutoScaled,&Imageset::setAutoScalingEnabled)
			.property("NativeResolution",&Imageset::getNativeResolution,&Imageset::setNativeResolution)
			.def("isImageDefined",&Imageset::isImageDefined)
			.def("getImage",&Imageset::getImage)
			.def("undefineImage",&Imageset::undefineImage)
			.def("undefineAllImages",&Imageset::undefineAllImages)
			.def("defineImage",(void(Imageset::*)(const String&,const Vector2&,const Size&,const Vector2&))&Imageset::defineImage)
			.def("defineImage",(void(Imageset::*)(const String&,const Rect&,const Vector2&))&Imageset::defineImage)			
			,
			class_<ImagesetManager>("ImagesetManager")			
			.def("createAll",&ImagesetManager::createAll)
			.def("create",(Imageset&(ImagesetManager::*)(const String&,Texture&,XMLResourceExistsAction))&ImagesetManager::create)			
			.def("createFromImageFile",&ImagesetManager::createFromImageFile)
			.enum_("XMLResourceExistsAction")
			[
				value("XREA_RETURN",XMLResourceExistsAction::XREA_RETURN),
				value("XREA_REPLACE",XMLResourceExistsAction::XREA_REPLACE),
				value("XREA_THROW",XMLResourceExistsAction::XREA_THROW)
			]
			.scope
				[
					def("getSingleton",&ImagesetManager::getSingleton)
				]
			,
			class_<Font,PropertySet>("Font")
			.property("Name",&Font::getName)
			.property("TypeName",&Font::getTypeName)
			.property("CodepointAvailable",&Font::isCodepointAvailable)
			.property("NativeResolution",&Font::getNativeResolution,&Font::setNativeResolution)
			.property("AutoScaled",&Font::isAutoScaled,&Font::setAutoScaled)
			.def("notifyDisplaySizeChanged",&Font::notifyDisplaySizeChanged)
			.def("getLineSpacing",&Font::getLineSpacing)
			.def("getFontHeight",&Font::getFontHeight)
			.def("getBaseline",&Font::getBaseline)
			.def("getTextExtent",&Font::getTextExtent)			
			.def("getCharAtPixel",(size_t(Font::*)(const String&,size_t,float,float)const)&Font::getCharAtPixel)
			.def("getCharAtPixel",(size_t(Font::*)(const String&,float,float)const)&Font::getCharAtPixel)			
			,
			class_<FontManager>("FontManager")
			.def("createPixmapFont",&FontManager::createPixmapFont)
			.scope
			[
				def("getSingleton",&FontManager::getSingleton)
			]
			,
			class_<Image>("Image")
			.property("Size",&Image::getSize)
			.property("Width",&Image::getWidth)
			.property("Height",&Image::getHeight)
			.property("Offsets",&Image::getOffsets)
			.property("Name",&Image::getName)
			.property("Imageset",&Image::getImageset)
			.property("ImagesetName",&Image::getImagesetName)
			.property("SourceTextureArea",&Image::getSourceTextureArea)							
		];
}